import { http } from "@/utils/http";

type Result = {
  status: number;
  total: number;
  msg: string;
  type: number;
  list: Array<any>;
  matches: Array<any>;
};

const baseUrl = "/api/zoomeye";
const headers = {
  "API-KEY": "EADe609f-247B-862a5-A643-4304d5bc8c0"
};
export const searchDomain = domain => {
  const params = {
    q: domain,
    type: 0,
    page: 1
  };

  return http.request<Result>("get", baseUrl + "/domain/search", {
    params,
    headers
  });
};

export const searchHost = host => {
  const params = {
    query: "ip:" + host
  };

  return http.request<Result>("get", baseUrl + "/host/search", {
    params,
    headers
  });
};
